﻿using DatabaseService.DatabaseDAO;
using System.Collections.Generic;

namespace You.Respository
{
    /// <summary>
    /// 仓储层接口
    /// </summary>
    public interface IRespository<T> where T : TableModelMapper, new()
    {
        /// <summary>
        /// 获取列表数据
        /// </summary>
        /// <returns></returns>
        IList<T> GetList();

        /// <summary>
        /// 通过主键Id获取数据
        /// </summary>
        /// <param name="id">主键Id</param>
        /// <returns></returns>
        T GetById(int id);

        /// <summary>
        /// 判断是否存在数据
        /// </summary>
        /// <param name="id">主键Id</param>
        /// <returns></returns>
        bool IsExistById(int id);

        /// <summary>
        /// insert
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        bool Insert(T entity);

        /// <summary>
        /// delete
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        bool Delete(T entity);

        /// <summary>
        /// update
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        bool Update(T entity);
    }
}
